package com.flower.config;

import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName AliyunOss
 * @Description aliyun配置文件读取
 * @Author 吃麻椒的花酱
 * @Date 2022/3/16 11:08
 * @Version 1.0
 */
@ConfigurationProperties(prefix = "spring.oss")
public class AliyunOss implements InitializingBean {
    private String endpoint;
    private String accessKeyId;
    private String accessKeySecret;
    private String bucketName;

    public static String ENDPOINT;
    public static String ASSESS_KEY_ID;
    public static String ASSESS_KEY_SECRET;
    public static String BUCKET_NAME;


    //属性设置后
    @Override
    public void afterPropertiesSet() throws Exception {
        ENDPOINT=this.endpoint;
        ASSESS_KEY_ID=this.accessKeyId;
        ASSESS_KEY_SECRET = this.accessKeySecret;
        BUCKET_NAME = this.bucketName;
    }

    public AliyunOss() {
    }

    public String getEndpoint() {
        return endpoint;
    }

    public void setEndpoint(String endpoint) {
        this.endpoint = endpoint;
    }

    public String getAccessKeyId() {
        return accessKeyId;
    }

    public void setAccessKeyId(String accessKeyId) {
        this.accessKeyId = accessKeyId;
    }

    public String getAccessKeySecret() {
        return accessKeySecret;
    }

    public void setAccessKeySecret(String accessKeySecret) {
        this.accessKeySecret = accessKeySecret;
    }

    public String getBucketName() {
        return bucketName;
    }

    public void setBucketName(String bucketName) {
        this.bucketName = bucketName;
    }
}
